/*
 * Copyright (C), 2002-2015, 苏宁易购电子商务有限公司
 * FileName: ConfigController.java
 * Author:   13082136
 * Date:     2015-10-28 下午12:04:05
 * Description: //模块目的、功能描述      
 * History: //修改记录
 * <author>      <time>      <version>    <desc>
 * 修改人姓名             修改时间            版本号                  描述
 */
package com.suning.sawp.web.controller;

import java.security.Principal;
import java.util.HashMap;
import java.util.Map;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.suning.sawp.constants.ConfigConstants;
import com.suning.sawp.constants.LoggerConstants;
import com.suning.sawp.service.util.SCMConfigUtil;
import com.suning.sawp.web.exception.MyGsonView;

/**
 * 查询系统配置： 线上消单url<br>
 *
 * @author 13082136
 * @see [相关类/方法]（可选）
 * @since [产品/模块版本] （可选）
 */
@Controller
@RequestMapping("/sys")
public class ConfigController extends DjBaseController {
	private static final Logger LOGGER = LoggerFactory
			.getLogger(LoggerConstants.SAWP_SERVICE);

	@RequestMapping("/getConfig.do")
	public MyGsonView queryOrder(Principal principal) {
		Map<String, Object> data = new HashMap<String, Object>();

		// 线上消单url handleOrderUrl
		String handleOrderUrl = SCMConfigUtil.getConfig(ConfigConstants.HANDEL_ORDER_URL);
		// 添加V购记录URL
		String addVbuyUrl = SCMConfigUtil.getConfig(ConfigConstants.ADD_VBUY_URL);
		// 全民发券记录
		String allSendCouponUrl = SCMConfigUtil.getConfig(ConfigConstants.ALL_SEND_COUPON_URL);
		LOGGER.debug("get handleOrderUrl from zk, handleOrderUrl={}", handleOrderUrl);
		LOGGER.debug("get addVbuyUrl from zk, addVbuyUrl={}", handleOrderUrl);


		data.put("handleOrderUrl", handleOrderUrl);
		data.put("addVbuyUrl", addVbuyUrl);
		data.put("allSendCouponUrl", allSendCouponUrl);

		MyGsonView view = createGsonView();
		view.addStaticAttribute("data", data);

		return view;
	}

}
